function timeToNow(recordTime, yearsFlag = true) {
    if (recordTime) {
        let localDate = new Date(recordTime).toLocaleDateString()
        recordTime = new Date(recordTime)
        let now = new Date();
        let diff = now - recordTime;
        if (diff / 3600000 / 24 / 365 > 1) {
            return new Date(recordTime).toLocaleDateString();
        } else if (diff / 3600000 / 24 > 3) {
            return new Date(recordTime).toLocaleDateString();
        } else if (diff / 3600000 / 24 > 1) {
            return parseInt(diff / 3600000 / 24) + "天前"
        } else if (now.getDay() - recordTime.getDay() == 1) {
            return "昨天" + recordTime.getHours() + ":" + recordTime.getMinutes();
        } else if (diff / 3600000 > 1) {
            return parseInt(diff / 3600000) + "小时前"
        } else if (diff > 60000) {
            return parseInt(diff / 60000) + "分钟前"
        } else {
            return "刚刚"
        }
    }
    return '';
}
export {
    timeToNow
}
